<html>
 <head>
  <meta name="layout" content="main"/>
  <r:require modules="typeAhead"/>
 </head>
 <body>
     <div>
       <ul> 
        <li><a href="${createLink(uri:'/')}">HOME</a></li>
        <li><g:link action="create" >Nueva Venta</g:link></li>
       </ul>
     </div>
	 <table id="dataTableWithOutSearch" class="table table-striped table-bordered dataTable">
	   <thead>
	      <tr>
	         <th>Id</th>	      
	         <th>Semana</th>
	         <th>Desde</th>
	         <th>Hasta</th>       
	         <th>Costo</th>
	         <th>Ingreso</th>
	         <th>Ganancia</th>	         	         	         
	         <th>%Ganancia</th>	         
	      </tr>
	   </thead>
	   <tbody>
	    <g:each var="item" in="${ventaSemanaListInstance}">
	      <tr id="${item.id}">  
	       <td><g:link action="show" id="${item.id}">${item.id}</g:link></td>
	       <td>${item.semana}</td>
	       <td><g:formatDate date="${item.desde}" formatName="default.date.format.common" /></td>	       	       
	       <td><g:formatDate date="${item.hasta}" formatName="default.date.format.common" /></td>
	       <td><g:formatNumber number="${item.costoTotal}" formatName="default.number.cash.format" minFractionDigits="2"/></td>
	       <td><g:formatNumber number="${item.ingresoTotal}" formatName="default.number.cash.format" minFractionDigits="2"	/></td>
	       <td><g:formatNumber number="${item.ingresoTotal - item.costoTotal}" formatName="default.number.cash.format"
	                           minFractionDigits="2"/></td>
	       <td>
		       <g:formatNumber number="${item.ingresoTotal/item.costoTotal-1}" 
		                       formatName="default.number.percent.format"/> 
           </td>
           <td><input type="button" value="Borrar" onclick="indexController.borrarVenta(${item.id})"/></td>
	      </tr>
	    </g:each>
	   </tbody>
	 </table>   
 </body>
</html>